﻿using System;
using System.Data;
using System.Configuration;
using DatabaseService;

/// <summary>
/// Summary description for GoldenPrice_Factory
/// </summary>
/// 
namespace WorldIndexInfo
{

    public class WorldIndex_Factory
    {
       /* public Price Hcm = new Price();
        public Price Ha_noi = new Price();
        public Price Da_nang = new Price();
        public Price Nha_trang = new Price();
        public Price Can_tho = new Price();
*/
        public Index Nadaqinfo = new Index();
        public Index SP500info = new Index();
        public Index Londoninfo = new Index();
        public Index JASDAQinfo = new Index();
        public Index Russiainfo = new Index();
        public Index Hongkonginfo = new Index();
        public Index Nikkei225info = new Index();
        public Index DJIAinfo = new Index();

        public WorldIndex_Factory()    
            
        {

        }

        public void getInfo(string className)
        {
            Object obj = Activator.CreateInstance(Type.GetType("WorldIndexInfo." + className));
            WorldIndex GP = obj as WorldIndex;
            GP.getInfo();
            this.Nadaqinfo = WorldIndex.UniqueInstance.Nadaqinfo;
            this.SP500info = WorldIndex.UniqueInstance.SP500info;
            this.Hongkonginfo = WorldIndex.UniqueInstance.Hongkonginfo;
            this.Nikkei225info = WorldIndex.UniqueInstance.Nikkei225info;
            this.JASDAQinfo = WorldIndex.UniqueInstance.JASDAQinfo;
            this.Londoninfo = WorldIndex.UniqueInstance.Londoninfo;
            this.DJIAinfo = WorldIndex.UniqueInstance.DJIAinfo;
            
        }

        public bool writeToDB(string className)
        {
            this.getInfo(className);
            AccessDB.InsertWorldIndexDB(this, className);
            return true;
        }
    }
}